/*
 * logging.h
 *
 *  Created on: Aug 6, 2013
 *      Author: Thuan Nguyen
 */
#ifndef LOGGING_H_
#define LOGGING_H_

#include<stdio.h>
#include<stdlib.h>
#include<stdarg.h>
#include<string.h>
#include"tp_types.h"

#define MAX_CHARACTERS_IN_LINE 140


#define TRANSPORT_SYSLOG 0x0100
#define	APPLICATION_SYSLOG 0x0200
#define	CONTENT_SYSLOG 0x0300
#define COMMON_SYSLOG 0x0400

enum logging_t{
	INFO_SYSLOG = 1,
	WARNING_SYSLOG,
	ERROR_SYSLOG,
	DEBUG_SYSLOG
};
enum module_logging_t{


	TRANSPORT_INFO = 0x0101,
	TRANSPORT_WARNING = 0x0102,
	TRANSPORT_ERROR = 0x0103,
	TRANSPORT_DEBUG = 0x0104,
	
	APPLICATION_INFO = 0x0201,
	APPLICATION_WARNING = 0x0202,
	APPLICATION_ERROR = 0x0203,
	APPLICATION_DEBUG = 0x0204,

	CONTENT_INFO = 0x0301,
	CONTENT_WARNING = 0x0302,
	CONTENT_ERROR = 0x0303,
	CONTENT_DEBUG = 0x0304,

	COMMON_INFO = 0x0401,
	COMMON_WARNING = 0x0402,
	COMMON_ERROR = 0x0403,
	COMMON_DEBUG = 0x0404,
};
void printf_func(U8 log,U16 module,U8 *file_name,U32 line_num,const U8 *format,...);


/*Start: Application Logging*/

#define SYSLOG_APPLICATION_INFO_LOGGING(format,args...) \
        printf_func(INFO_SYSLOG,APPLICATION_SYSLOG,__FILE__,__LINE__,format,##args);

#define SYSLOG_APPLICATION_WARNING_LOGGING(format,args...)\
        printf_func(WARNING_SYSLOG,APPLICATION_SYSLOG,__FILE__,__LINE__,format,##args);

#define SYSLOG_APPLICATION_ERROR_LOGGING(format,args...)\
        printf_func(ERROR_SYSLOG,APPLICATION_SYSLOG,__FILE__,__LINE__,format,##args);

#define SYSLOG_APPLICATION_DEBUG_LOGGING(format,args...)\
        printf_func(DEBUG_SYSLOG,APPLICATION_SYSLOG,__FILE__,__LINE__,format,##args);

/*End: Application Logging*/

/*Start: Content Logging*/

#define SYSLOG_CONTENT_INFO_LOGGING(format,args...)\
        printf_func(INFO_SYSLOG,CONTENT_SYSLOG,__FILE__,__LINE__,format,##args);

#define SYSLOG_CONTENT_WARNING_LOGGING(format,args...)\
        printf_func(WARNING_SYSLOG,CONTENT_SYSLOG,__FILE__,__LINE__,format,##args);

#define SYSLOG_CONTENT_ERROR_LOGGING(format,args...)\
        printf_func(ERROR_SYSLOG,CONTET_SYSLOG,__FILE__,__LINE__,format,##args);

#define SYSLOG_CONTENT_DEBUG_LOGGING(format,args...)\
        printf_func(DEBUG_SYSLOG,CONTENT_SYSLOG,__FILE__,__LINE__,format,##args);

/*End: Content Logging*/

/*Start: Transport Logging*/

#define SYSLOG_TRANSPORT_INFO_LOGGING(format,args...)\
        printf_func(INFO_SYSLOG,TRANSPORT_SYSLOG,__FILE__,__LINE__,format,##args);

#define SYSLOG_TRANSPORT_WARNING_LOGGING(format,args...)\
        printf_func(WARNING_SYSLOG,TRANSPORT_SYSLOG,__FILE__,__LINE__,format,##args);

#define SYSLOG_TRANSPORT_ERROR_LOGGING(format,args...)\
        printf_func(ERROR_SYSLOG,TRANSPORT_SYSLOG,__FILE__,__LINE__,format,##args);

#define SYSLOG_TRANSPORT_DEBUG_LOGGING(format,args...)\
        printf_func(DEBUG_SYSLOG,TRANSPORT_SYSLOG,__FILE__,__LINE__,format,##args);
/*End: Transport Logging*/

/*Start: Common Logging*/
#define SYSLOG_COMMON_INFO_LOGGING(format,args...)\
        printf_func(INFO_SYSLOG,COMMON_SYSLOG,__FILE__,__LINE__,format,##args);

#define SYSLOG_COMMON_WARNING_LOGGING(format,args...)\
        printf_func(WARNING_SYSLOG,COMMON_SYSLOG,__FILE__,__LINE__,format,##args);

#define SYSLOG_COMMON_ERROR_LOGGING(format,args...)\
        printf_func(ERROR_SYSLOG,COMMON_SYSLOG,__FILE__,__LINE__,format,##args);

#define SYSLOG_COMMON_DEBUG_LOGGING(format,args...)\
        printf_func(DEBUG_SYSLOG,COMMON_SYSLOG,__FILE__,__LINE__,format,##args);
/*End: Common Logging*/

#endif

